﻿@model WebUI.Models.Recuper
@using (Ajax.BeginForm(new AjaxOptions()
{
    LoadingElementId="OnLoadingSpan",UpdateTargetId = "DoctorListView",
    InsertionMode = InsertionMode.Replace,
    HttpMethod = "Post",
    OnSuccess = "$('#dialogbox').dialog('close');",
    OnFailure = "OnSiteError"
}))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>医生信息</legend>
        @Html.Hidden("reciver", Model.User.UserId)
        <table width="100%">
                <tr>
                    <td valign="middle" align="left">
                        请输入短信内容，或使用模板<br />
                        @Html.DropDownList("SmsTextList", new SelectList(ViewBag.Templates, "SmsText", "SmsText"), new { id = "smsDDL", style = "width:80%" })
                                        <input id="btnImport" class="ui-button ui-widget ui-state-default ui-corner-all"
                        type="button" value="导入" onclick="$('#txtmessage').val($('#txtmessage').val()+$('#smsDDL').val());$('#smsTextCount').text('字数：'+$('#txtmessage').val().length.toString())" />          
                    </td>
                </tr>
                <tr>                    
                    <td>
                        @Html.TextArea("txtmessage", string.Empty, 10, 60, null)
                    </td>
                </tr>
                <tr>
                    <td><span id="smsTextCount"></span>
                    </td>
                    <td>
                        @Helpers.SubmitButton("发送")
                    </td>
                </tr>
        </table>
    </fieldset>
}

<script type="text/javascript">
    $(document).ready(function () {
        var text = $("#txtmessage").val();
        var counter = text.length;
        if (counter != 0) {
            $("#smsTextCount").text("字数：" + counter.toString());
        }
        else {
            $("#smsTextCount").text("");
        }
        $("#txtmessage").keyup(function () {
            var text = $("#txtmessage").val();
            var counter = text.length;
            if (counter != 0) {
                $("#smsTextCount").text("字数：" + counter.toString());
            }
            else {
                $("#smsTextCount").text("");
            }
        });
    });

    </script>